/**
* ...
* @author Default
* @version 0.1
*/

package bdz.dms.data{
	import bdz.dms.vo.CoreDataVO;
	public dynamic class DMSCollection extends Array {
		function DMSCollection(){
		}
		public function where(prop:String, value:*):DMSCollection{
			var result:DMSCollection = new DMSCollection();
			var mirror:Array = this.slice();
			for each(var vo:CoreDataVO in mirror){
				if(vo[prop] == value){
					result.push(vo);
				}
			}
			mirror = null;
			return result;
		}
		public function whereHasProperty(prop:String):DMSCollection{
			var result:DMSCollection = new DMSCollection();
			var mirror:Array = this.slice();
			for each(var vo:CoreDataVO in mirror){
				if(vo.getPropertyName(prop) != null){
					result.push(vo);
				}
			}
			return result;
		}
		public function wherePropertyName(prop:String, value:*):DMSCollection{
			var result:DMSCollection = new DMSCollection();
			var mirror:Array = this.slice();
			for each(var vo:CoreDataVO in mirror){
				if(vo.getPropertyName(value) == value){
					result.push(vo);
				}
			}
			return result;
		}
		public function whereProperty(prop:String, value:*):DMSCollection{
			var result:DMSCollection = new DMSCollection();
			var mirror:Array = this.slice();
			for each(var vo:CoreDataVO in mirror){
				if(vo.getProperty(prop) == value){
					result.push(vo);
				}
			}
			return result;
		}
	}
	
}